package cn.edu.zafu.bigdata.bd121.studentdb.command.impl;

import cn.edu.zafu.bigdata.bd121.studentdb.cli.CliMain;
import cn.edu.zafu.bigdata.bd121.studentdb.command.BaseCommand;

import java.sql.SQLException;

/**
 * 退出系统
 *
 * @author 202211090121
 */
public class QuitSystem extends BaseCommand {

    /**
     * 执行命令
     */
    @Override
    public void execute() {
        try {
            CliMain.connection.close();
        } catch (SQLException e) {
            System.err.println("数据库异常");
            throw new RuntimeException(e);
        }
        System.exit(0);
    }
}
